import java.util.List;

/**
 * ShapeCalculator: 接受 Shape 引用并计算面积，演示多态与里氏替换原则。
 */
public class ShapeCalculator {

    // 计算单个形状的面积
    public double calculateArea(Shape s) {
        return s.getArea();
    }

    // 计算形状列表的总面积
    public double totalArea(List<Shape> shapes) {
        double total = 0.0;
        for (Shape s : shapes) {
            total += s.getArea();
        }
        return total;
    }
}
